package com.mszlu.msauth.admin.controller;

import com.mszlu.msauth.response.PageResult;
import com.mszlu.msauth.response.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1/organization")
public class OrganizationController {
    @Autowired
    private OrganizationService organizationService;

    @PostMapping("/listPage")
    public Result<PageResult<Organization>> listPage(@RequestBody OrganizationDTO org) {
        return Result.success(organizationService.findByPage(org));
    }

    @PostMapping("/list")
    public Result<List<OrganizationVO>> listOrganization(@RequestBody(required = false) OrganizationDTO org) {
        return Result.success(organizationService.listOrganization(org));
    }
}